package user

import (
	"apiserver/model"
	"gopkg.in/go-playground/validator.v9"
)

type CreateRequest struct {
	Username  string `json:"username" validate:"required"`
	Password  string `json:"password" validate:"required"`
	VPassword string `json:"v_password" validate:"required"`
	Email     string `json:"email" validate:"required"`
}
type CreateResponse struct {
	Username string `json:"username"`
}
type ListRequest struct {
	Username string `json:"username"`
	Offset   int    `json:"offset"`
	Limit    int    `json:"limit"`
}
type ListResponse struct {
	TotalCount uint64            `json:"totalCount"`
	UserList   []*model.UserInfo `json:"userList"`
}

func (c *CreateRequest) ValidateCreate() error {
	validate := validator.New()
	return validate.Struct(c)
}
func (l *ListRequest) ValidateList() error {
	validate := validator.New()
	return validate.Struct(l)
}
